<?php

namespace app\index\validate\consulting;

use ShidianUtil\Thinkphp\Validate\BaseValidate;

/**
 * Class LawCase
 * @package app\consulting\validate
 * @link https://www.kancloud.cn/manual/thinkphp6_0/1037623
 */
class LawCase extends BaseValidate
{

    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'id'	=> 'isId',
		'questionId'	=> 'integer|max:11',
		'memberId'	=> 'integer|max:11',
		'createrId'	=> 'integer|max:11',
		'createrMemberType'	=> 'integer|egt:0|max:3',
		'ask'	=> 'scalar|max:2000',
		'categoryId'	=> 'integer|max:5',
		'provinceId'	=> 'integer|max:8',
		'cityId'	=> 'integer|max:8',
		'phone'	=> 'scalar|max:11',
		'alwaysLive'	=> 'integer|max:3',
		'isSelf'	=> 'integer|max:3',
		'employLawyer'	=> 'integer|max:3',
		'price'	=> 'numeric',
		'num'	=> 'integer|egt:0|max:1',
		'surplus'	=> 'integer|egt:0|max:1',
		'updated'	=> 'integer|egt:0|max:11',
		'created'	=> 'integer|egt:0|max:11',
        'page'      => 'integer|egt:0|max:11',
        'page_size' => 'integer|egt:0|max:11',
    ];

    protected $field = [
        'id'	=> 'id',
		'questionId'	=> 'questionId',
		'memberId'	=> 'memberId',
		'createrId'	=> 'createrId',
		'createrMemberType'	=> 'createrMemberType',
		'ask'	=> 'ask',
		'categoryId'	=> 'categoryId',
		'provinceId'	=> 'provinceId',
		'cityId'	=> 'cityId',
		'phone'	=> 'phone',
		'alwaysLive'	=> 'alwaysLive',
		'isSelf'	=> 'isSelf',
		'employLawyer'	=> 'employLawyer',
		'price'	=> 'price',
		'num'	=> 'num',
		'surplus'	=> 'surplus',
		'updated'	=> 'updated',
		'created'	=> 'created',
        'page'      => '分页页数',
        'page_size' => '分页大小',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'id.require'	=> '缺少:attribute',
		'id.isId'	=> '请设置正确的:attribute',
		'questionId.require'	=> '请输入:attribute',
		'questionId.integer' => ':attribute应该是整数',
		'questionId.max'	=> ':attribute长度不能超过:rule位',
		'memberId.require'	=> '请输入:attribute',
		'memberId.integer' => ':attribute应该是整数',
		'memberId.max'	=> ':attribute长度不能超过:rule位',
		'createrId.require'	=> '请输入:attribute',
		'createrId.integer' => ':attribute应该是整数',
		'createrId.max'	=> ':attribute长度不能超过:rule位',
		'createrMemberType.require'	=> '请输入:attribute',
		'createrMemberType.integer' => ':attribute应该是整数',
		'createrMemberType.egt'	=> ':attribute应该大于等于:rule',
		'createrMemberType.max'	=> ':attribute长度不能超过:rule位',
		'ask.require'	=> '请输入:attribute',
		'ask.scalar' => ':attribute应该是字符串',
		'ask.max'	=> ':attribute长度不能超过:rule位',
		'categoryId.require'	=> '请输入:attribute',
		'categoryId.integer' => ':attribute应该是整数',
		'categoryId.max'	=> ':attribute长度不能超过:rule位',
		'provinceId.require'	=> '请输入:attribute',
		'provinceId.integer' => ':attribute应该是整数',
		'provinceId.max'	=> ':attribute长度不能超过:rule位',
		'cityId.require'	=> '请输入:attribute',
		'cityId.integer' => ':attribute应该是整数',
		'cityId.max'	=> ':attribute长度不能超过:rule位',
		'phone.require'	=> '请输入:attribute',
		'phone.scalar' => ':attribute应该是字符串',
		'phone.max'	=> ':attribute长度不能超过:rule位',
		'alwaysLive.require'	=> '请输入:attribute',
		'alwaysLive.integer' => ':attribute应该是整数',
		'alwaysLive.max'	=> ':attribute长度不能超过:rule位',
		'isSelf.require'	=> '请输入:attribute',
		'isSelf.integer' => ':attribute应该是整数',
		'isSelf.max'	=> ':attribute长度不能超过:rule位',
		'employLawyer.require'	=> '请输入:attribute',
		'employLawyer.integer' => ':attribute应该是整数',
		'employLawyer.max'	=> ':attribute长度不能超过:rule位',
		'price.require'	=> '请输入:attribute',
		'price.numeric' => ':attribute应该是数字',
		'num.require'	=> '请输入:attribute',
		'num.integer' => ':attribute应该是整数',
		'num.egt'	=> ':attribute应该大于等于:rule',
		'num.max'	=> ':attribute长度不能超过:rule位',
		'surplus.require'	=> '请输入:attribute',
		'surplus.integer' => ':attribute应该是整数',
		'surplus.egt'	=> ':attribute应该大于等于:rule',
		'surplus.max'	=> ':attribute长度不能超过:rule位',
		'updated.require'	=> '请输入:attribute',
		'updated.integer' => ':attribute应该是整数',
		'updated.egt'	=> ':attribute应该大于等于:rule',
		'updated.max'	=> ':attribute长度不能超过:rule位',
		'created.require'	=> '请输入:attribute',
		'created.integer' => ':attribute应该是整数',
		'created.egt'	=> ':attribute应该大于等于:rule',
		'created.max'	=> ':attribute长度不能超过:rule位',
        'page.require'      => '请输入:attribute',
        'page.integer'      => ':attribute应该是整数',
        'page.egt'          => ':attribute应该大于等于:rule',
        'page.max'          => ':attribute长度不能超过:rule位',
        'page_size.require' => '请输入:attribute',
        'page_size.integer' => ':attribute应该是整数',
        'page_size.egt'     => ':attribute应该大于等于:rule',
        'page_size.max'     => ':attribute长度不能超过:rule位',
    ];

    protected $scene = [
        'delete' => ['id' => 'require'],
        'index'  => ['page', 'page_size'],
        'read'   => ['id' => 'require'],
        'save'   => ['questionId', 'memberId', 'createrId', 'createrMemberType', 'ask', 'categoryId', 'provinceId', 'cityId', 'phone', 'alwaysLive', 'isSelf', 'employLawyer', 'price', 'num', 'surplus', 'updated', 'created'],
    ];

}
